namespace QMVnSoft.ReportForms
{
    using QMVnSoft;
    using QMVnSoft.Controls;
    using QMVnSoft.DAL;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormKCT06Viewer : FormReportViewer
    {
        private IContainer components;
        private LabelControl lblMa_Ct;
        private LabelControl lblNgay_Ct1;
        private LabelControl lblNgay_Ct2;
        private LabelControl lblSo_Ct1;
        private LabelControl lblSo_Ct2;
        private LabelControl lblTk;
        private TextControl txtMa_Ct;
        private TextDate txtNgay_Ct1;
        private TextDate txtNgay_Ct2;
        private TextControl txtSo_Ct1;
        private TextControl txtSo_Ct2;
        private TextControl txtTen_Tk;
        private TextSearch txtTk;

        public FormKCT06Viewer()
        {
            this.InitializeComponent();
            this.txtNgay_Ct1.Value = AppInstance.StartWorkingDate;
            this.txtNgay_Ct2.Value = AppInstance.EndWorkingDate;
        }

        public FormKCT06Viewer(object pd_Ngay_Ct1, object pd_Ngay_Ct2, object ps_Ma_Ct, object ps_So_Ct1, object ps_So_Ct2, object ps_Tk, object pi_Loai_Tte)
        {
            this.InitializeComponent();
            this.txtNgay_Ct1.Value = pd_Ngay_Ct1;
            this.txtNgay_Ct2.Value = pd_Ngay_Ct2;
            this.txtTk.Value = ps_Tk;
            this.txtTen_Tk.Value = this.txtTk.GetFieldData("Ten_Tk");
            this.OnMakeReport();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormKCT06Viewer));
            this.txtTen_Tk = new QMVnSoft.Controls.TextControl();
            this.txtTk = new QMVnSoft.Controls.TextSearch();
            this.lblMa_Ct = new QMVnSoft.Controls.LabelControl();
            this.lblTk = new QMVnSoft.Controls.LabelControl();
            this.txtNgay_Ct2 = new QMVnSoft.Controls.TextDate();
            this.lblNgay_Ct2 = new QMVnSoft.Controls.LabelControl();
            this.txtNgay_Ct1 = new QMVnSoft.Controls.TextDate();
            this.lblNgay_Ct1 = new QMVnSoft.Controls.LabelControl();
            this.txtMa_Ct = new QMVnSoft.Controls.TextControl();
            this.txtSo_Ct1 = new QMVnSoft.Controls.TextControl();
            this.lblSo_Ct1 = new QMVnSoft.Controls.LabelControl();
            this.txtSo_Ct2 = new QMVnSoft.Controls.TextControl();
            this.lblSo_Ct2 = new QMVnSoft.Controls.LabelControl();
            this.rptContainer.Panel1.SuspendLayout();
            this.rptContainer.SuspendLayout();
            this.SuspendLayout();
            // 
            // rptContainer
            // 
            // 
            // rptContainer.Panel1
            // 
            this.rptContainer.Panel1.Controls.Add(this.txtSo_Ct2);
            this.rptContainer.Panel1.Controls.Add(this.lblSo_Ct2);
            this.rptContainer.Panel1.Controls.Add(this.txtSo_Ct1);
            this.rptContainer.Panel1.Controls.Add(this.lblSo_Ct1);
            this.rptContainer.Panel1.Controls.Add(this.txtMa_Ct);
            this.rptContainer.Panel1.Controls.Add(this.txtNgay_Ct2);
            this.rptContainer.Panel1.Controls.Add(this.lblNgay_Ct2);
            this.rptContainer.Panel1.Controls.Add(this.txtNgay_Ct1);
            this.rptContainer.Panel1.Controls.Add(this.lblNgay_Ct1);
            this.rptContainer.Panel1.Controls.Add(this.txtTen_Tk);
            this.rptContainer.Panel1.Controls.Add(this.txtTk);
            this.rptContainer.Panel1.Controls.Add(this.lblMa_Ct);
            this.rptContainer.Panel1.Controls.Add(this.lblTk);
            this.rptContainer.SplitterDistance = 88;
            // 
            // txtTen_Tk
            // 
            this.txtTen_Tk.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Tk.BackColor = System.Drawing.SystemColors.Control;
            this.txtTen_Tk.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Tk.CheckTextSearched = false;
            this.txtTen_Tk.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Tk.Enabled = false;
            this.txtTen_Tk.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Tk.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Tk.Location = new System.Drawing.Point(214, 69);
            this.txtTen_Tk.Name = "txtTen_Tk";
            this.txtTen_Tk.OldValue = null;
            this.txtTen_Tk.Size = new System.Drawing.Size(458, 13);
            this.txtTen_Tk.TabIndex = 6;
            this.txtTen_Tk.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtTen_Tk.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Tk.Value = ((object)(resources.GetObject("txtTen_Tk.Value")));
            // 
            // txtTk
            // 
            this.txtTk.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtTk.CheckTextSearched = false;
            this.txtTk.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtTk.EmptyIsValid = true;
            this.txtTk.FieldDisplay = "Ten_Tk";
            this.txtTk.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTk.FoundIsValid = true;
            this.txtTk.Location = new System.Drawing.Point(108, 66);
            this.txtTk.MaxLength = 32;
            this.txtTk.Name = "txtTk";
            this.txtTk.OldValue = null;
            this.txtTk.Size = new System.Drawing.Size(100, 20);
            this.txtTk.TabIndex = 5;
            this.txtTk.TableName = "DMTK";
            this.txtTk.TextDisplay = this.txtTen_Tk;
            this.txtTk.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.txtTk.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtTk.Value = ((object)(resources.GetObject("txtTk.Value")));
            // 
            // lblMa_Ct
            // 
            this.lblMa_Ct.AutoSize = true;
            this.lblMa_Ct.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Ct.Location = new System.Drawing.Point(12, 48);
            this.lblMa_Ct.Name = "lblMa_Ct";
            this.lblMa_Ct.Size = new System.Drawing.Size(68, 14);
            this.lblMa_Ct.TabIndex = 88;
            this.lblMa_Ct.Text = "Mã chứng từ";
            // 
            // lblTk
            // 
            this.lblTk.AutoSize = true;
            this.lblTk.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTk.Location = new System.Drawing.Point(12, 69);
            this.lblTk.Name = "lblTk";
            this.lblTk.Size = new System.Drawing.Size(53, 14);
            this.lblTk.TabIndex = 87;
            this.lblTk.Text = "Tài khoản";
            // 
            // txtNgay_Ct2
            // 
            this.txtNgay_Ct2.DateTimeFormat  = QMVnSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct2.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNgay_Ct2.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtNgay_Ct2.Location = new System.Drawing.Point(316, 3);
            this.txtNgay_Ct2.Mask = "00/00/0000";
            this.txtNgay_Ct2.Name = "txtNgay_Ct2";
            this.txtNgay_Ct2.OldValue = null;
            this.txtNgay_Ct2.Size = new System.Drawing.Size(100, 20);
            this.txtNgay_Ct2.TabIndex = 1;
            this.txtNgay_Ct2.Value = ((object)(resources.GetObject("txtNgay_Ct2.Value")));
            // 
            // lblNgay_Ct2
            // 
            this.lblNgay_Ct2.AutoSize = true;
            this.lblNgay_Ct2.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblNgay_Ct2.Location = new System.Drawing.Point(256, 6);
            this.lblNgay_Ct2.Name = "lblNgay_Ct2";
            this.lblNgay_Ct2.Size = new System.Drawing.Size(54, 14);
            this.lblNgay_Ct2.TabIndex = 97;
            this.lblNgay_Ct2.Text = "Đến ngày";
            // 
            // txtNgay_Ct1
            // 
            this.txtNgay_Ct1.DateTimeFormat  = QMVnSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct1.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNgay_Ct1.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtNgay_Ct1.Location = new System.Drawing.Point(108, 3);
            this.txtNgay_Ct1.Mask = "00/00/0000";
            this.txtNgay_Ct1.Name = "txtNgay_Ct1";
            this.txtNgay_Ct1.OldValue = null;
            this.txtNgay_Ct1.Size = new System.Drawing.Size(100, 20);
            this.txtNgay_Ct1.TabIndex = 0;
            this.txtNgay_Ct1.Value = ((object)(resources.GetObject("txtNgay_Ct1.Value")));
            // 
            // lblNgay_Ct1
            // 
            this.lblNgay_Ct1.AutoSize = true;
            this.lblNgay_Ct1.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblNgay_Ct1.Location = new System.Drawing.Point(12, 6);
            this.lblNgay_Ct1.Name = "lblNgay_Ct1";
            this.lblNgay_Ct1.Size = new System.Drawing.Size(47, 14);
            this.lblNgay_Ct1.TabIndex = 98;
            this.lblNgay_Ct1.Text = "Từ ngày";
            // 
            // txtMa_Ct
            // 
            this.txtMa_Ct.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Ct.CheckTextSearched = false;
            this.txtMa_Ct.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtMa_Ct.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Ct.Location = new System.Drawing.Point(108, 45);
            this.txtMa_Ct.Name = "txtMa_Ct";
            this.txtMa_Ct.OldValue = null;
            this.txtMa_Ct.Size = new System.Drawing.Size(100, 20);
            this.txtMa_Ct.TabIndex = 4;
            this.txtMa_Ct.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtMa_Ct.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtMa_Ct.Value = ((object)(resources.GetObject("txtMa_Ct.Value")));
            // 
            // txtSo_Ct1
            // 
            this.txtSo_Ct1.CheckTextSearched = false;
            this.txtSo_Ct1.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtSo_Ct1.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtSo_Ct1.Location = new System.Drawing.Point(108, 24);
            this.txtSo_Ct1.Name = "txtSo_Ct1";
            this.txtSo_Ct1.OldValue = null;
            this.txtSo_Ct1.Size = new System.Drawing.Size(100, 20);
            this.txtSo_Ct1.TabIndex = 2;
            this.txtSo_Ct1.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtSo_Ct1.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtSo_Ct1.Value = ((object)(resources.GetObject("txtSo_Ct1.Value")));
            // 
            // lblSo_Ct1
            // 
            this.lblSo_Ct1.AutoSize = true;
            this.lblSo_Ct1.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblSo_Ct1.Location = new System.Drawing.Point(12, 27);
            this.lblSo_Ct1.Name = "lblSo_Ct1";
            this.lblSo_Ct1.Size = new System.Drawing.Size(35, 14);
            this.lblSo_Ct1.TabIndex = 100;
            this.lblSo_Ct1.Text = "Từ số";
            // 
            // txtSo_Ct2
            // 
            this.txtSo_Ct2.CheckTextSearched = false;
            this.txtSo_Ct2.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtSo_Ct2.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtSo_Ct2.Location = new System.Drawing.Point(316, 24);
            this.txtSo_Ct2.Name = "txtSo_Ct2";
            this.txtSo_Ct2.OldValue = null;
            this.txtSo_Ct2.Size = new System.Drawing.Size(100, 20);
            this.txtSo_Ct2.TabIndex = 3;
            this.txtSo_Ct2.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtSo_Ct2.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtSo_Ct2.Value = ((object)(resources.GetObject("txtSo_Ct2.Value")));
            // 
            // lblSo_Ct2
            // 
            this.lblSo_Ct2.AutoSize = true;
            this.lblSo_Ct2.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblSo_Ct2.Location = new System.Drawing.Point(256, 27);
            this.lblSo_Ct2.Name = "lblSo_Ct2";
            this.lblSo_Ct2.Size = new System.Drawing.Size(42, 14);
            this.lblSo_Ct2.TabIndex = 102;
            this.lblSo_Ct2.Text = "Đến số";
            // 
            // FormKCT06Viewer
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.CheckDetailMost = true;
            this.ClientSize = new System.Drawing.Size(794, 539);
            this.Name = "FormKCT06Viewer";
            this.rptContainer.Panel1.ResumeLayout(false);
            this.rptContainer.Panel1.PerformLayout();
            this.rptContainer.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        protected override void OnGenerateColumns()
        {
            if (base.CurrencyIndex == 0)
            {
                object[][] objArray = new object[7][];
                object[] objArray2 = new object[4];
                objArray2[0] = "Ngay_Ps";
                objArray2[1] = "Ngày ghi sổ";
                objArray2[2] = "D";
                objArray[0] = objArray2;
                object[] objArray3 = new object[4];
                objArray3[0] = "Ngay_Ct";
                objArray3[1] = "Ngày chứng từ";
                objArray3[2] = "D";
                objArray[1] = objArray3;
                object[] objArray4 = new object[4];
                objArray4[0] = "So_Ct";
                objArray4[1] = "Số chứng từ";
                objArray4[2] = "C";
                objArray[2] = objArray4;
                object[] objArray5 = new object[4];
                objArray5[0] = "Dien_Giai";
                objArray5[1] = "Diễn giải";
                objArray5[2] = "C";
                objArray[3] = objArray5;
                object[] objArray6 = new object[4];
                objArray6[0] = "Tk";
                objArray6[1] = "Tài khoản";
                objArray6[2] = "C";
                objArray[4] = objArray6;
                objArray[5] = new object[] { "Ps_No", "Phát sinh nợ", "N", AppInstance.TextNumericFormat.LocalAmount };
                objArray[6] = new object[] { "Ps_Co", "Phát sinh có", "N", AppInstance.TextNumericFormat.LocalAmount };
                base.LocalColNames = objArray;
                base.OnGenerateColumns();
            }
            else
            {
                object[][] objArray9 = new object[10][];
                object[] objArray10 = new object[4];
                objArray10[0] = "Ngay_Ps";
                objArray10[1] = "Ngày ghi sổ";
                objArray10[2] = "D";
                objArray9[0] = objArray10;
                object[] objArray11 = new object[4];
                objArray11[0] = "Ngay_Ct";
                objArray11[1] = "Ngày chứng từ";
                objArray11[2] = "D";
                objArray9[1] = objArray11;
                object[] objArray12 = new object[4];
                objArray12[0] = "So_Ct";
                objArray12[1] = "Số chứng từ";
                objArray12[2] = "C";
                objArray9[2] = objArray12;
                object[] objArray13 = new object[4];
                objArray13[0] = "Dien_Giai";
                objArray13[1] = "Diễn giải";
                objArray13[2] = "C";
                objArray9[3] = objArray13;
                object[] objArray14 = new object[4];
                objArray14[0] = "Tk";
                objArray14[1] = "Tài khoản";
                objArray14[2] = "C";
                objArray9[4] = objArray14;
                objArray9[5] = new object[] { "Ps_No", "Ps Nợ", "N", AppInstance.TextNumericFormat.LocalAmount };
                objArray9[6] = new object[] { "Ps_Co", "Ps C\x00f3", "N", AppInstance.TextNumericFormat.LocalAmount };
                objArray9[7] = new object[] { "Ty_Gia", "Tỷ giá", "N", AppInstance.TextNumericFormat.LocalAmount };
                objArray9[8] = new object[] { "Ps_No_Nt", "Ps Nợ Nt", "N", AppInstance.TextNumericFormat.LocalAmount };
                objArray9[9] = new object[] { "Ps_Co_Nt", "Ps C\x00f3 Nt", "N", AppInstance.TextNumericFormat.LocalAmount };
                base.ForeignColNames = objArray9;
                base.OnGenerateColumns();
            }
        }

        protected override void OnMakeReport()
        {
            AppInstance.StartWorkingDate = (DateTime) this.txtNgay_Ct1.Value;
            AppInstance.EndWorkingDate = (DateTime) this.txtNgay_Ct2.Value;
            this.OnGenerateColumns();
            base.LocalTable = new ReportDataAccess().KCT06_Get(AppInstance.Subsidiaries, this.txtNgay_Ct1.Value, this.txtNgay_Ct2.Value, this.txtMa_Ct.Value, this.txtSo_Ct1.Value, this.txtSo_Ct2.Value, this.txtTk.Value, AppInstance.DefLanguage);
            base.OnMakeReport();
        }

        protected override void OnSendParameters()
        {
            base.StimulReport["Ngay"] = "Từ ngày " + string.Format("{0:dd/MM/yyyy}", this.txtNgay_Ct1.Value) + " đến ngày " + string.Format("{0:dd/MM/yyyy}", this.txtNgay_Ct2.Value);
            if (string.IsNullOrEmpty(this.txtTk.Value.ToString()))
            {
                base.StimulReport["TaiKhoan"] = "";
            }
            else
            {
                base.StimulReport["TaiKhoan"] = string.Concat(new object[] { "Tài khoản: ", this.txtTen_Tk.Value, " (", this.txtTk.Value, ")" });
            }
        }
    }
}

